<template>
  <!--PDF文件上传并且将数据转成word-->
  <div class="container">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClickTabs" class="tabsContainer">
      <!--pdf转word-->
      <el-tab-pane name="1">
        <span slot="label"><i class="el-icon-document"></i>{{pdfToWordTitle}}</span>
        <file-upload-pdf-to-other :ref="pdfToWord.ref" :elUploadTip="elUploadTip" :elUploadType ="elUploadType"></file-upload-pdf-to-other>
      </el-tab-pane>

      <!--PDF转Excel-->
      <el-tab-pane name="2">
        <span slot="label">
          <i class="el-icon-edit"></i>{{pdfToExcelTitle}}
        </span>
        <file-upload-pdf-to-other :ref="pdfToExcel.ref" :elUploadTip="elUploadTip" :elUploadType ="elUploadType"></file-upload-pdf-to-other>
      </el-tab-pane>


      <!--PDF转图片-->
      <el-tab-pane name="3">
        <template #label>
          <span> <i class="el-icon-refresh-left"></i>{{pdfToPictureTitle}}</span>
        </template>
        <file-upload-pdf-to-other :ref="pdfToPicture.ref" :elUploadTip="elUploadTip" :elUploadType ="elUploadType"></file-upload-pdf-to-other>
      </el-tab-pane>

      <!--PDF转PPT-->
      <el-tab-pane name="4">
        <span slot="label">
          <i class="el-icon-folder-checked"></i>{{pdfToPptTitle}}
        </span>
        <file-upload-pdf-to-other :ref="pdfToPPT.ref" :elUploadTip="elUploadTip" :elUploadType ="elUploadType"></file-upload-pdf-to-other>
      </el-tab-pane>

      <!--PDF转TXT-->
      <el-tab-pane name="5">
        <template #label>
          <span> <i class="el-icon-check"></i>{{pdfToTxtTitle}}</span>
        </template>
        <file-upload-pdf-to-other :ref="pdfToTxt.ref" :elUploadTip="elUploadTip" :elUploadType ="elUploadType"></file-upload-pdf-to-other>
      </el-tab-pane>
    </el-tabs>
  </div>


</template>

<script>
  import fileUploadPdfToOther from "./fileUploadMain/fileUploadPdfToOther";

  export default {
    name: "fileUploadList",
    components: {
      fileUploadPdfToOther
    },
    data() {
      return {
        //文件上传，文件数据
        fileUploadPdfList: [],
        activeName: '1',//tab初始为1
        pdfToWordTitle: 'PDF转Word',
        pdfToExcelTitle: 'PDF转Excel',
        pdfToPictureTitle: 'PDF转图片',
        pdfToPptTitle: 'PDF转PPT',
        pdfToTxtTitle: 'PDF转TXT',
        elUploadTip: '',//子组件的上传提示
        elUploadType:'',//判断上传转换的类型
        pdfToWord: {
          ref: 'wordRef', // 组件ref
        },
        pdfToExcel: {
          ref: 'excelRef', // 组件ref
        },
        pdfToPicture: {
          ref: 'pictureRef', // 组件ref
        },
        pdfToPPT: {
          ref: 'pptRef', // 组件ref
        },
        pdfToTxt: {
          ref: 'txtRef', // 组件ref
        },
      }
    },
    mounted() {
      this.loadMain(this.activeName);
    },
    created() {

    },
    methods: {
      /*数据初始化*/
      loadMain(type) {
        if (type == 1) {
          this.elUploadType = '1'
          this.elUploadTip = 'PDF转Word，请上传PDF类型文件'
        }
        if (type == 2) {
          this.elUploadType = '2'
          this.elUploadTip = 'PDF转Excel，请上传PDF类型文件';
        }
        if (type == 3) {
          this.elUploadType = '3'
          this.elUploadTip = 'PDF转图片，请上传PDF类型文件';
        }
        if (type == 4) {
          this.elUploadType = '4'
          this.elUploadTip = 'PDF转PPT，请上传PDF类型文件';
        }
        if (type == 5) {
          this.elUploadType = '5'
          this.elUploadTip = 'PDF转TxT，请上传PDF类型文件';
        }
      },
      /*点击其他的tab栏*/
      handleClickTabs(tab) {
        this.loadMain(tab.name)
      }
    }
  }
</script>

<style scoped>

</style>
